<template>
	<loading-page v-if="data.loading" />
	<web-view v-if="data.webview.show" :src="data.webview.src"></web-view>
</template>
<script setup>
	import { reactive } from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	const data = reactive({
		options: {},
		loading: true,
		webview: {
			src: '',
			show: false
		}
	});
	onLoad((options) => {
		data.options = options;
		const title = options.title ? decodeURIComponent(options.title) : '';
		const url = options.url ? decodeURIComponent(options.url) : '';
		if (title) uni.setNavigationBarTitle({
			title
		});
		if (url) {
			data.webview.src = url;
			data.webview.show = true;
		}
		setTimeout(() => {
			data.loading = false;
		}, 3000)
	});
</script>
